<template>
  <div class="particulars">
    <v-detail
      :detailData="data.detailData"
      :inputConfig="inputConfig"
      :rules="rules"
      ref="input"
    ></v-detail>
  </div>
</template>

<script>
import detail from "commons/Detail";
import baseMixin from "@/mixins/BaseMixin";

export default {
  name: "particulars",
  mixins: [baseMixin],
  props: {
    data: {
      type: Object
    }
  },
  data () {
    return {
      inputConfig: [
        [
          // {
          //   type: "input",
          //   label: this.$t('config.areaCode'),
          //   props: "areakey",
          // },
          {
            type: "select",
            label: this.$t('config.area'),
            props: "putawayzone",
            options: this.getOptions("queryputawayzone1")
          }
        ]
      ],
      rules: {
        areakey: [
          { required: true, validator: this.areakey, trigger: 'blur' },
        ],
        putawayzone: [
          { required: true, message: this.$t('config.inputAreaPlease'), trigger: 'blur' },
        ]
      },
    }
  },
  computed: {},
  methods: {
    areakey (rule, value, callback) {
      if (value === '') {
        callback(new Error());
      } else {
        var re = /^[^\u4e00-\u9fa5]{0,}$/;
        let te = value;
        let flag = re.test(te)
        if (flag) {
          callback();
        } else {
          this.$message.error(this.$t('config.areaCanNotHasZh'));
          this.data.detailData[rule.field] = ""
          callback(new Error());
        }
      }
    },
  },
  mounted () {
  },
  components: {
    "v-detail": detail,
  },

}
</script>

<style scoped>
</style>
